<template>
  <div class="about">
    <van-nav-bar title="账号管理" left-text="返回" left-arrow @click-left="onClickLeft" fixed />
    <div class="content">
      <van-cell-group>
        <van-cell title="姓名" :value="info.nickName" />
        <van-cell title="手机号" :value="info.phonenumber" />
        <van-cell title="性别" :value="info.sex" />
        <van-cell title="邮箱" :value="info.email" />
        <van-cell @click="repass" is-link>修改密码</van-cell>
        <van-cell @click="loginout" is-link>退出登录</van-cell>
      </van-cell-group>
    </div>
  </div>
</template>
<script>
export default {
  mounted: function() {
    this.loginpPerson();
  },

  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    loginpPerson() {
      let paramForms = {};
      this.$axios.get("prod-api/common/getLoginInfo", paramForms).then(res => {
        if (200 == res.data.code) {
          localStorage.setItem("userName", res.data.user.userName);
          this.info = res.data.user;
        } else {
        }
      });
    },
    repass() {
      this.$router.push("/repass");
    },
    loginout() {
      this.out();
    },
    out() {
      let paramForms = {};
      this.$axios.post("prod-api/common/logout", paramForms).then(res => {
        if (200 == res.data.code) {
          this.$router.push("/login");
          this.$toast.fail(res.data.msg);
        } else {
          this.$toast.fail(res.data.msg);
        }
      });
    }
  },
  data() {
    return {
      info: []
    };
  }
};
</script>
<style lang="scss" scoped>
.content {
  padding-top: 50px;
  position: relative;

  .cdb {
    position: absolute;
    right: 0;
  }
}
.van-nav-bar {
  background: url("../assets/bg2.png");
}
</style>